<template>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
      :visible.sync="visible"
      :before-close="cancel"
      class="JNPF-dialog JNPF-dialog_center"
      lock-scroll
      width="80%"
    >
      <el-row :gutter="15" class="">
        <el-form
          ref="elForm"
          :model="dataForm"
          :rules="rules"
          label-width="100px"
        >
        
        <el-col :span="8">
          <el-form-item class="required" label="样品编号" prop="fsampleno">
            <el-input v-model="dataForm.fsampleno"  placeholder="请输入"/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item class="required" label="样品分类" prop="fclassstno">
            <el-select
              v-model="dataForm.fclassstno"
              placeholder="请输入" >
              <el-option
                v-for="item in catlist"
                :key="item.fclassstno"
                :label="item.fclassstname"
                :value="item.fclassstno"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item class="required" label="状态" prop="fdanger">
            <el-select
              v-model="dataForm.fdanger"
              placeholder="请选择" >
              <el-option
                v-for="item in fdangerlist"
                :key="item.value"
                :label="item.lable"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item class="required" label="样品名称" prop="fsamplename">
            <el-input v-model="dataForm.fsamplename" placeholder="请输入"/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="英文名称">
            <el-input v-model="dataForm.fengname" placeholder="请输入"/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item  label="送检编号" >
            <el-input v-model="dataForm.fcode" placeholder="请输入"/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item  label="规格" >
            <el-input v-model="dataForm.fspec" placeholder="请输入"/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item class="required" label="单位" prop="funit">
            <el-input v-model="dataForm.funit" placeholder="请输入"/>
          </el-form-item>
        </el-col>


        </el-form>
      </el-row>
      <el-tabs style="width: 100%" type="border-card">

        <el-tab-pane label="检测说明">
         <el-row :gutter="15" class="">
           <el-form  ref="elForm"  :model="dataForm" :rules="rules" label-width="100px" >
           <el-col :span="24">
            <el-form-item class="required" label="检测概要" prop="fsampleno">
              <el-input
                type="textarea"
                :rows="3"
                placeholder="请输入内容"
                v-model="textarea1">
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item class="required" label="检测项目" prop="fsampleno">
              <el-input
                type="textarea"
                :rows="5"
                placeholder="请输入内容"
                v-model="textarea2">
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item class="required" label="检测方法" prop="fsampleno">
              <el-input
                type="textarea"
                :rows="3"
                placeholder="请输入内容"
                v-model="textarea3">
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="24">
            <el-form-item class="required" label="检测标准" prop="fsampleno">
              <el-input
                type="textarea"
                :rows="3"
                placeholder="请输入内容"
                v-model="textarea4">
              </el-input>
            </el-form-item>
          </el-col>

          </el-form>
         </el-row>


        </el-tab-pane>

        <el-tab-pane label="耗材列表">
          <JNPF-table :data="list">
            <el-table-column align="left" label="行号" type="index" width="50"/>
            <el-table-column align="left" label="耗材编号" prop="fmaterialno" />
            <el-table-column align="left" label="耗材名称" prop="fmaterialname" />
            <el-table-column align="left" label="所需数量" prop="fqty" />
          </JNPF-table>
          <div class="addbox">
            <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
          </div>
        </el-tab-pane>

      <el-tab-pane label="危化品列表">
        <JNPF-table :data="list2">
          <el-table-column align="left" label="行号" type="index" width="50"/>
          <el-table-column align="left" label="危化品编号" prop="fgoodno" />
          <el-table-column align="left" label="危化品名称" prop="fgoodname" />
        </JNPF-table>
        <div class="addbox">
          <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div>
      </el-tab-pane>
      <el-tab-pane label="化验步骤">
        <JNPF-table :data="list">
          <el-table-column align="left" label="行号" prop="fbarcode" />
           <el-table-column align="left" label="化验设备" prop="fbarcode" />
          <el-table-column align="left" label="化验步骤" prop="fbarcode" />
          <el-table-column align="left" label="化验时间(分)" prop="fbarcode" />
          <el-table-column align="left" label="化验说明" prop="fbegdate" />
        </JNPF-table>
        <div class="addbox">
          <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div>
      </el-tab-pane>
      </el-tabs>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
        <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
      </span>
    </el-dialog>
  </template>
  <style>
    .addbox{
      text-align: center;
      padding: 10px 0;
    }
  </style>
  <script>
  import jnpf from "@/utils/jnpf"
  export default {
    data() {
      return {
          title:"新增",
          textarea1:"饲料添加剂是指在饲料生产加工、使用过程中添加的少量或微量物质，在饲料中用量很少但作用显著。饲料添加剂是现代饲料工业必然使用的原料，对强化基础饲料营养价值，提高动物生产性能，保证动物健康，节省饲料成本，改善畜产品品质等方面有明显的效果。",
          textarea2:'常规理化指标：水分、粗蛋白质、总磷、粗灰分、钙、粗纤维、粗脂肪、氯化钠、脂肪酸、各种氨基酸'
            +'\r\n'+'重金属及有害物质：重金属(镉、铬、铅、砷、汞等)、三聚氰胺、赤霉烯酮、呕吐毒素、黄曲霉毒素'
            +'\r\n'+'微生物指标：菌落总数、大肠菌群、致病菌、霉菌和酵母菌等'
            +'\r\n'+'饲用酶制剂：纤维素酶、植酸酶、果胶酶、淀粉酶、葡聚糖酶、木聚糖酶、酸性蛋白酶、中性蛋白酶、半纤维素酶、半乳糖苷酶、糖化酶、脂肪酶等'
            +'\r\n'+'其他检测项目：丙二醛、过氧化值、氟、酸价、叶黄素、磷酸二氢钙、硫酸铜、硫酸锌、硫酸镁、硫酸亚铁、硫酸锰、面粉中面筋含量、磷脂丙酮不溶物、挥发性盐基氢、液体磷脂乙醚不溶物、Vc含量、胆固醇、淀粉糊化度。',
          textarea3:'定性定量分析、未知物再利用、无机物定性定量、成分分析、剂定性定量、指定成分验证、主成分定性定量、配方复原、指定成分定量、主成分定性、表面活性剂定性定量。',
          textarea4:'GB/T 21543-2008饲料添加剂通用要求'
            +'\r\n'+'GB/T 18632-2010饲料添加剂80%核黄素（维生素B2）微粒'
            +'\r\n'+'GB/T 19370-2003饲料添加剂1%β-胡萝卜素'
            +'\r\n'+'GB/T 21515-2008饲料添加剂天然甜菜碱'
            +'\r\n'+'GB/T 21543-2008饲料添加剂调味剂通用要求',
          list: [],
          list2:[],
          catlist:[
            {id:"1",fullName:"肉类"},
            {id:"2",fullName:"水果"},
            {id:"3",fullName:"水产"},],
          fdangerlist:[ 
            {id:"1",fullName:"是"},
            {id:"0",fullName:"否"},],
          dataForm:{
            fclassstno: "饲料添加剂检测",
            foperator: "",
            fsampleno: "100001",
            fsamplename: "实验猪配合饲料",
            fbarcode: undefined,
            fengname: undefined,
            fspec: "500g",
            funit: "g",
            fdanger: "0",
            fsafecard: undefined,
            fsamplestate: '3002',
            fupddate: new Date(),
          },
        loading:false,
        visible:false,
        insertorupdate:true
      };
    },
    created() {
    },
    mounted() {},
    methods: {
      //
      init(id){
        this.dataForm.FCATNO= id || ''
          if(this.dataForm.FCATNO)
          {
              this.title="修改"
             this.insertorupdate=false;
          }
          else
          {
            this.insertorupdate=true;
              this.title="新增";
          }
          this.visible=true;
      },
      //
      cancel(){
          this.$refs.elForm.resetFields();
          this.visible=false;
      },
    },
  };
  </script>
  
  
  
  
  